#ifndef _IOOPERATIONIMPL_H_
#define _IOOPERATIONIMPL_H_

#include "stdafx.h"
#include <io/ioperation.h>

class CIoOperationImpl : public IOperation, public CUnknownImp
{
public:
    CIoOperationImpl(void);
    virtual ~CIoOperationImpl(void);

    BEGIN_STDCOM_MAP
    STDCOM_INTERFACE_ENTRY(IOperation)
    STDCOM_INTERFACE_ENTRY_UNKNOWN_(IOperation)
    END_STDCOM_MAP

    // IIoOperation
    std_method(BindIBase)(IBase* pBase);
    std_method(UnBindIBase)();
    std_method(QueryIBaseIID)(REFIID riid, void** ppv);
    std_method(BindEvent)(IBase* pEvents);
    std_method(UnBindEvent)();
    std_method(SetId)(crtid id);
    std_method_(crtid, GetId)();
    std_method(SetResult)(crterr err, buf_len len);
    std_method(GetResult)(crterr* err, buf_len* len);
    std_method(SetIoParam)(buf_len pos, buf_len len);
    std_method(GetIoParam)(buf_len* pos, buf_len* len);
    std_method(SetExpect)(buf_len len);
    std_method(GetExpect)(buf_len* len);
    std_method(SetPos)(buf_len pos);
    std_method(GetPos)(buf_len* pos);
    std_method(SetTransfered)(buf_len len);
    std_method(GetTransfered)(buf_len* len);
    std_method(Attach)(buf_ptr ptr, buf_len pos, buf_len size);
    std_method(Alloc)(buf_len size);
    std_method(GetLen)(buf_len* len);
    std_method(GetPtr)(buf_ptr* ptr);
    std_method(GetOperationPtr)(buf_ptr* ptr, buf_len* len);
    std_method(ReleasePtr)();
    std_method(ClearPtr)();
    std_method(Post)(crtid cid, crterr err);

private:
    crterr m_err;
    crtid m_cid;
    buf_len m_pTransferedBytes;
    buf_len m_uStartPos;
    buf_len m_uExpectBytes;
    buf_len m_pBufLen;
    UCharArrayPtr m_pBuf;
    _lComPtr<IOperationProc> m_pEvent;
    _lComPtr<IBase> m_pBase;
};
#endif
